<template>
  <div>
    <el-container class="bg-white" :style="{ height: h + 'px' }">
      <el-header class="image-header flex items-center">
        <el-button @click="showAddImg">新增图片分类</el-button>
        <el-button @click="handleOpenUpload">上传图片</el-button>
      </el-header>
      <el-container>
        <ImageAside ref="ImageAsideRef" @change="change" />
        <ImageMain ref="ImageMainRef" />
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import ImageAside from '@/components/ImageAside.vue'
import ImageMain from '@/components/ImageMain.vue'

import { ref, } from 'vue'
const windowHeight = window.innerHeight || document.body.clientHeight
const h = windowHeight - 200

const ImageAsideRef = ref(null)
const ImageMainRef = ref(null)
const showAddImg = () => {
  ImageAsideRef.value.changeDrawer(true)
}

const change = (id) => {
  ImageMainRef.value.loadData(id)
}

const handleOpenUpload = ()=>ImageMainRef.value.openUploadFile()
</script>

<style>
.image-header {
  border-bottom: 1px solid #eee;
}
</style>
